package com.shushan.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.shushan.lockscreen.LockScreenWindowManager;
import com.shushan.util.DateUtils;

/**
 * @ClassName: TimeMgLockReceiver
 * @Desciption: 时间管理锁屏广播接收器
 * @author: yichaohua
 * @date: 2018-07-25
 */
public class TimeMgLockReceiver extends BroadcastReceiver {

    private static final String TAG = "TimeMgLockReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        int frequDay = intent.getIntExtra("frequDay",0);
        Log.i(TAG,"onReceive() frequDay=" + frequDay);

        int weekIndex = DateUtils.getWeekIndex();
        if((frequDay & (1<<weekIndex)) > 0){
            Log.i(TAG,"createLockFloatWindow");
            LockScreenWindowManager.createLockFloatWindow(context);
        }

    }
}
